Tag: npm

运行命令npm run dev时出错

我开始做一个新的应用程序的第一次,我安装了git和node.js,并设置path..从bitbucket的链接我克隆了项目,然后我给了npm install ..高兴这一切都很好,但是当我给了npm run dev ,这是抛出这个错误: 我认为这个问题与path有关,我不知道该怎么改变。 我的path如下所示: 论坛中的其他问题并不能解决我的问题。

运行`yarn`时如何更改主目录?

我有一个nodejs项目并使用yarn来构build它。 由于某些原因,用户主目录是只读的。 当我在我的项目中运行yarn install ,出现以下错误: error An unexpected error occurred: "EACCES: permission denied, mkdir '/home/jenkins/.config'". 似乎yarn正试图访问用户主目录。 如何限制yarn只能使用当前的应用程序目录? 我知道npm我可以使用下面的环境变化,但我不知道如何做yarn 。 export npm_config_cache=npm-cache

在cmd中安装离子时出错

使用cmd尝试安装离子时,我总是收到错误 在此之前我已经安装了Node JS $ npm install -g cordova ionic npm ERR! code SELF_SIGNED_CERT_IN_CHAIN npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN npm ERR! request to https://registry.npmjs.org/cordova failed, reason: self signed certificate in certificate chain npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\samar_000\AppData\Roaming\npm-cache\_logs\2017-07- 23T10_58_18_779Z-debug.log

用Laravel灵药临界CSS

我正在使用gulp软件包的关键css ,以前我安装这个软件包: npm install –save critical 但是在运行gulp –production ,npm向我报告这个错误: mix.critical is not a function 这是我完整的gulpfile代码: var elixir = require('laravel-elixir'); var BrowserSync = require('laravel-elixir-browsersync'); var critical = require('critical'); elixir(function(mix) { mix.styles([ "bootstrap.css", "bootstrap-theme.css", "main.css", "jquery.fancybox.css", "font-awesome.css", ]).version("css/all.css") mix.critical({ src: 'http://myapp.dev', css: 'public/css/all.css', width: 1280, height: 600, dest: 'public/css/critical.css' }); }); 为什么npm报告我这个错误?

有没有一种方法来确认package-lock.json实际上解决了package.json中的所有依赖关系?

我们希望向CI服务器添加一个自动检查,以防止代码被提交,从而更新package.json的依赖项,但不更新package-lock.json已parsing的依赖package-lock.json 。 例如,如果某人手动更新了package.json的依赖项,但是运行npm install而不是npm update ( npm install package-lock.json ,如果存在),则可能发生这种情况。 或者,即使有人在更新依赖项时运行了正确的npm命令,但忘记将结果更改提交到package-lock.json也可能发生这种情况。 我们试图在代码审查中观察这些事情,但是自动检查肯定会更好。 有没有这样的npm命令? 这里有一个例子来说明。 之前 : // package.json { "lodash": "~3.1.0" } // package-lock.json { "dependencies": { "lodash": { "version": "3.1.3" } } } 有人更新package.json但忘记将更改提交到package-lock.json 。 后: // package.json { "lodash": "~3.2.0" } // package-lock.json (not changed) { "dependencies": { "lodash": { "version": "3.1.3" } […]

Google Compute Engine Bookshelf教程:npm ERR! networking读取ECONNRESET

我目前正在通过GCE Bookshelf教程,这是最让我头疼的: https : //cloud.google.com/nodejs/tutorials/bookshelf-on-compute-engine 我被困在这一步: To see the application running, go to http://[YOUR_INSTANCE_IP]:8080, where [YOUR_INSTANCE_IP] is the external IP address of your instance. 当我尝试通过端口8080在我的外部IP上查看我的应用程序时,没有任何反应。 我可以确认防火墙规则正确地应用于显示正确networking标记的虚拟机实例。 我浏览了系列日志,发现启动脚本有些问题,因为实例无法克隆git仓库。 所以我改变了 git clone https://source.developers.google.com/p/$PROJECTID /opt/app 至 git clone https://source.developers.google.com/p/d3-barchart/r/repo /opt/app (其余的startup-script.sh这里:) #! /bin/bash # Copyright 2017, Google, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); […]

terminal将不会打开npm二进制,即使它在那里

我使用sudo npm install mtemplate -g安装了一个全局npm包。 mtemplate包出现在我的/usr/local/bin目录中。 当我在该目录的terminal中键入ls时,它显示出来。 我可以在finder中看到它。 但是当我在terminal(或其任何变体)中inputmtemplate或/usr/local/bin/mtemplate , No such file or directory 根据文档,应该可以从terminal运行mtemplate 。 为什么没有发现,即使是在那里?

错误:在WebStorm中找不到模块“内部/链接列表”

我有一个运行良好的脚本,当我运行在terminal与节点,但使用WebStorm我无法正常运行,因为它崩溃的依赖需求线。 我试图npm install internal/linkedList ,我也试图npm cache clean (如另一篇文章中推荐)。 完整的堆栈跟踪是: Error: Cannot find module 'internal/linkedlist' at Function.Module._resolveFilename (module.js:485:15) at Function.Module._load (module.js:437:25) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at Object.<anonymous> (/Users/harshagoli/Library/Preferences/WebStorm2017.2/javascript/nodejs/8.1.4/core-modules/timers.js:26:11) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3)

获取package.json文件中另一个字段的值(npm)

我有以下package.json文件: { "main": "./dist/index.js", "scripts": { "build": "tsc", "build:live": "tsc && node ./dist/index.js" }, … } 我怎么能得到的main领域的价值,然后把它放到命令node ./dist/index.js ,这样的事情(只是一个例子,我知道这$是ENVvariables): { "main": "./dist/index.js", "scripts": { "build": "tsc", "build:live": "tsc && node $main" }, … } 提前致谢

无法获取模块引用

我在尝试在某个文件中使用下划线模块时遇到了一个奇怪的错误,尽pipe我可以在同一个项目中的其他文件中使用它。 我认为这个问题和下划线模块本身没有关系。 文件的开头是以下内容: … var moment = require('moment'); var _ = require('underscore'); … 然后,当我尝试在函数中使用下划线时,出现错误 '‌ReferenceError: _ is not defined' 如果我尝试在同一个函数中使用其他模块,一切运作良好,而且,如果我在其他文件中使用下划线,它也可以正常工作,所以我不知道什么是错的。 我试图删除node_modules文件夹并运行npm更新,但问题仍然存在。 以下是文件夹结构,其中只包含相关的文件和文件夹: . ├── app.js ├── bower.json ├── default.json ├── lib │ ├── dbHelper.js ├── node_modules ├── routes │ ├── api.js 在api.js下划线工作正常,而在dbHelper.js不起作用。 有没有人遇到类似的问题? 有谁知道什么可能是错的,如何解决?