I updated to TACO 10 & VS 2015 2. I am getting the following error due to a long path.
1> Installing npm 2.14.9. This could take a few minutes...
1> Failed: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Is there any way to tell VS to use the globally installed npm. I tried installing .NET Web Development and Tools Blog and changing the path orders on the External Web Tools options.
I also tried unchecking the use sandbox node but VS still tries to install npm.
Any ideas?
Windows doesn't like the way npm would do the nested dependency trees in npm v1.x & v2.x, eventually they will throw this error. The nested dependency trees will create very long path names and will hit a cap in windows.
You should instead use npm v3.x, npm went to a flat dependency structure with v3.x and this issue will go away.
Related
I'm getting this output when trying to install a node application using npm install:
$ npm install
> ejs#2.7.4 postinstall /home/dh_8u42k7/quotegoodeair.com/node_modules/ejs
> node ./postinstall.js
/home/dh_8u42k7/quotegoodeair.com/node_modules/ejs/postinstall.js:9
let envDisable = isTrue(process.env.DISABLE_OPENCOLLECTIVE) || isTrue(process.
^^^
SyntaxError: Unexpected strict mode reserved word
I have already found this question which contains a workaround. However, this isn't my own code, so I can't just remove "let", it seems to be a problem with ejs itself.
For another thing, the file postinstall.js doesn't even exist, even the ejs folder doesn't exist, so I can't just go in and edit the file.
Is there something wrong with my node application, or with ejs, or maybe with npm or Node itself? Why does Node install components which aren't supported by Node? Why does Node tell me there's an error in a file which doesn't exist?
It may be that your version of node does not support the features in the application you are trying to install.
One solution may be to find out what the version of node the application that you are trying to install originally used.
I believe you can check the engine field in your package.json file.
If you local node version is different, and you need to change it, here is a link to a question providing that information: How can I specify the required Node.js version in package.json?
I also found this post interesting: https://github.com/tj/n/issues/472
It's for a different application but they received the same error message. The issue was conflicting npm folders. It's possible that the program that you are trying to install is conflicting with your existing npm setup if you have other nom folders in the directory you are installing the application in.
Ultimately, given the information you provided, I think your best bet it to look in the package.json file of the application you're trying to install and see if your local setup is conflicting with how the program is trying to be installed or run.
Nice to meet you. I'm a beginner in computer and these days have enjoyed your sophisticated Q&As here. This is my first question in StackOverFlow. Please forgive me when I use not common notations and unnatural English.
I trid for several hours to install external modules in Node-Red (Node.js ?).
I’d like to install three---“fs”, ”path”, and “js-yaml”--- in Windows 10 but my trouble is that only “js-yaml” resulted in failure although the others can be successfully installed and used.
I tried the following command…
C:\windows\system32>npm –g install js-yaml
C:\windows\system32>npm –g install fs
C:\windows\system32>npm –g install path
These commands created the modules, but only js-yaml behaved differently from the other two. After adding appropriate keys and properties such as “ fs: require(‘fs’)” to functionGlobalContext in (C:~~~/.node-red/) setting.js, I tried to start Node-Red.
When I commanded
C:\windows\system32> node-red
it returned the following errors only on js-yaml and node-red did not open. It ran successfully when I removed the term “jsyaml: require(‘js-yaml’)” from setting.js.
Error loading C:~~~/.node-red/setteing.js
Error cannot find module “js-yaml”
I’ll list reports which may be related with my problem.
*The other two (fs, path) created the folders only in the directory “C:~~~/npm/node-modules”, but js-yaml created another js-yaml file apart from there in “C:~~~/npm”.
*Perhaps I tried “npm link” command in each directory before install command. And npm link [module name] in C:~~~/.node-red directory.
*I downloaded external module (node-red-contrib-postgres) from github, which may have fs.js and path.js??
*It did not change the result to add “js-yaml” term into “dependency” in (C:~~~/.node-red/) package.json.
*I add C:~~~/npm.node_modules(got by "npm -g bin"command) to enviroment variable "PATH"
I would suggest you install them locally, not globally.
When you install npm modules globally using -g, they are stored under %APPDATA%\npm, which is user-specific, and to which Node Red may not have access, depending on how it's being run.
Have a look at Running on Windows under "Sharing Node-RED between Users" and npm-folders for further info.
Alternatively, you can also put the actual path in functionGlobalContext, which may work for you. Along the lines of:
js-yaml: require(‘/the/path/to/js-yaml’)
Windows, VSC, Running npm start got this
npm WARN lifecycle The node binary used for scripts is C:\Program
Files\nodejs\node.exe but npm is using
C:\somewhere\AppData\Roaming\npm\node_modules\node\bin\node.exe
itself. Use the --scripts-prepend-node-path option to include the
path for the node binary npm was executed with.
I understand it means my local version is diff from the one in the PATH variable (C:\Program Files...). How do proceed to tell it to use --scripts-prepend-node-path?
I played a trick by replacing the C:\Program Files\nodejs with C:\somewhere\AppData\Roaming\npm\node_modules\node\bin in PATH variable, it does pick up that new node.exe got but there is no node binary in the current PATH. Again recommend to use the --scrip
ts-prepend-node-path option to include the path for the node binary npm was executed with
Like I said, replacing the actual path in PATH system variable didn't fix the problem completely, it still complained about binary is missing. Found this solved the there is no node binary in the current PATH problem. So I restored the original PATH, then:
Simply create a file at the root folder of the app, called .npmrc,
place this line into it:
scripts-prepend-node-path=true
Here's another way that works: npm config set scripts-prepend-node-path auto
Conflict between your node binary and your npm
In case the error looks something like:
npm is trying to use the same node as the one it use to run itself.
resolve this conflict by adding the node directory to your PATH:
npm config set scripts-prepend-node-path true
From the npm documentation:
npm run sets the NODE environment variable to the node executable with
which npm is executed. Also, if the --scripts-prepend-node-path is
passed, the directory within which node resides is added to the PATH
Having this issue in Visual Studio 2017, I instead told VS to always use the NodeJS that I had installed from nodejs.org rather than the frozen-in-time one that ships with Visual Studio. (The one that shipped with VS2015 is so ancient it doesn't really work anymore.)
In Visual Studio, go to TOOLS > OPTIONS > search for EXTERNAL WEB TOOLS > and ensure "C:\Program Files\nodejs" (or wherever nodejs.org installed it) is first in the list of paths, adding it if necessary.
For WebStorm, invalidating caches and restarting worked for me.
I'm having an issue with resolving a warning highlighted by npm audit. I followed the path to the dependent package which had the issue and ran the suggested fix command to update the dependency package that was causing the issue.
The path looks like this: npm/node_modules/npm-profile/node_modules/make-fetch-happen
Now when I run npm audit in the make-fetch-happen folder there are no errors, and the same happens with npm-profile and npm. But when I go back up one level to the package containing npm the audit still highlights the original issue as though it hasn't been resolved.
I am new to using npm so I'm not sure how the file structure works or what effect it has running commands like this at different levels of the file structure.
Is there a command I can run to make the higher level package acknowledge the fix that was run at the lower level?
Sometimes this bug occurs because the package-lock.json is buggy. If you look for the leveraged library within your package-lock. You should see it by searching for the package name and look to see if there are any with an outdated version number. Chances are there will be. I found being on npm#6.1 deleting both the node_modules and the lock file and npm installing fixed the issue. But sometimes it may not work.
I am trying to use an api from github that takes rate my professor ratings and the instructions were fairly clear. https://github.com/shafi-dayatar/rmp-api
npm install rmp-api --save
which worked but once I require it
var rmp = require('rmp-api');
It gives me the error
Error: Cannot find module 'rmp-api'
I've tried rebuilding the app, reinstalling all the dependencies and still nothing. Is there something I might be missing from the installation?
The rmp-api package is no longer hosted in NPM. At this time, if you visit the npm page for rmp-api, you will see the following description:
This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.
It appears this happened 9 months ago, and based on the last commit being in August of 2016, I'd guess this package has been abandoned. If you want to use it, you can install it using the githubname/reponame syntax (see the documentation for more details):
npm install --save shafi-dayatar/rmp-api